﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Extensions.StringExtension
{
    public static class StringExtension
    {
        /// <summary>
        /// Converts a String to a string array basis to a string separator
        /// </summary>
        /// <param name="text"></param>
        /// <param name="separator"></param>
        /// <returns></returns>
        public static string[] ConvertToArray(this string text, string separator)
        {
            return text.Split(Convert.ToChar(separator));
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="text"></param>
        /// <param name="separator"></param>
        /// <returns></returns>
        public static string[] ConvertToArray(this string text, char[] separator)
        {
            return text.Split(separator);
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="text"></param>
        /// <param name="separator"></param>
        /// <param name="count"></param>
        /// <param name="option"></param>
        /// <returns></returns>
        public static string[] ConvertToArray(this string text, string[] separator, int count, StringSplitOptions option)
        {
            return text.Split(separator, count, option);
        }
    }
}
